/**
 * @Title: feeView_service.js
 * @Description: 费用service
 * Copyright: Copyright (c) 2014 
 * Company:中国平安
 *
 * @Project HIMS-FWA
 * @author QIANDUO875
 * @date 2014年9月28日 上午15:02:31
 * @version V1.0
 */
;
(function(){
	'use strict';
	
	var app = angular.module('fwa.services');
	app.service('FeeViewService',['$http','BaseURL', function($http, baseUrl){
		
//		var debug = true,
		var debug = false,
		debugUrls = {
			getFeeExeInfos:baseUrl + 'mock/achievements/settlement/getFeeExecuteInfo.json',
			getFeeHappenAnalysis:baseUrl + 'mock/achievements/settlement/getFeeHappenAnalysis.json'
		},
		urls = {
			getFeeExeInfos:baseUrl + 'feeExecute/getFeeExecuteInfo.do',
            getFeeHappenAnalysis:baseUrl + 'feeExecute/getFeeHappenAnalysis.do'
			//getFeeHappenAnalysis:baseUrl + 'mock/achievements/settlement/getFeeHappenAnalysis.json'
		};
//		serv = this;
		
		function getUrl(name) {
			if(debug) {
				return debugUrls[name];
			} else {
				return urls[name];
			}
		}
		
		this.getFeeExeInfos = function(date,type,kpiKey,visitType) {
			return $http({
				url:getUrl('getFeeExeInfos'),
				method:'GET',
				params:{
					startDate:date.start,
					endDate:date.end,
					type:type,
					kpiKey:kpiKey,
					visitType:visitType					
				}
			});
		}
		
		this.getFeeHappenAnalysis = function(date,visitType) {
			return $http({
				url:getUrl('getFeeHappenAnalysis'),
				method:'GET',
				params:{
					startDate:date.start,
					endDate:date.end,
					visitType:visitType
				}
			});
		}
	}]);
	
})();